package com.frame.hander;

import javax.servlet.http.HttpServletRequest;

import com.jfinal.core.Controller;

/**
 * @author LRC
 * @createDate 2015年5月26日
 * @description 客户端信息处理类 
 */
public class ClientHander {
	//客户端信息类
	public static class Client{
		public String host;
		public String ip;
		public String mac;
		@Override
		public String toString() {
			return "Client [host=" + host + ", ip=" + ip + ", mac=" + mac + "]";
		}
	}
	
	public static Client getIp(Controller c){
		if(c==null)return null;
		//获取httprequest
		HttpServletRequest rq =  c.getRequest();
		Client client = new Client();
		client.host = rq.getRemoteHost();
		client.ip = rq.getRemoteAddr();
		try {
			//获取mac太耗时
			//client.mac = new UdpGetClientMacAddrHelper(client.ip, 200).GetRemoteMacAddr();
		} catch (Exception e) {
		}
		return client;
	}
}
